/** ###################################################################
**     Filename  : ADC.C
**     Project   : ADC
**     Processor : 56F8013VFAE
**     Version   : Driver 01.14
**     Compiler  : Metrowerks DSP C Compiler
**     Date/Time : 2012-3-11, 17:11
**     Abstract  :
**         Main module.
**         This module contains user's application code.
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/
/* MODULE ADC */


/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "AD1.h"
#include "PWM1.h"
#include "PWM2.h"
#include "TI1.h"
#include "EInt1.h"
#include "EInt2.h"
#include "EInt3.h"
#include "Term1.h"
#include "Inhr2.h"
#include "TMR4.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"

//word *ADvaluez,*ADvaluex,*ADvaluey;
word ADvalue[3];
uint8_t *ch;
int flag;
//word tempz=0,tempx=0,tempy=0;
//byte flag ;
//uint8_t st[6]="     ";
void main(void)
{


  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/
  flag=0;

  /* Write your code here */
//  EInt1_Enable();
//  EInt2_Enable();

//  EInt3_Enable();

  for(;;) {
     
//    AD1_GetValue16(ADvaluez);
 //     Term1_SendNum(555);

  
/*    Term1_SendChar(' ');
    Term1_SendNum((int)(ADvalue[1]>>6)-512);
    Term1_SendChar(' ');
    Term1_SendNum((int)(ADvalue[2]>>6)-512);
    Cpu_Delay100US(10);  */
    



//  Term1_ReadChar(ch);

    if(*ch=='1')
      flag=1;
    else if(*ch=='0')
      flag=0;
    else if(*ch=='2')
      flag=2;
    
    if(flag==1)
    {
    	PWM1_SetRatio16(ADvalue[0]);
    	PWM2_SetRatio16(0);
    }
    else if(flag==2)
    {
    	PWM1_SetRatio16(0);
    	PWM2_SetRatio16(ADvalue[0]);    	
    }
    else if(flag==0)
    {
    	PWM1_SetRatio16(0);
        PWM2_SetRatio16(0);
    }               

  }
}

/* END ADC */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.00 [04.35]
**     for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/












































